package avicit.bdp.dds.api.controller;

import avicit.bdp.dds.api.service.ProcessDefinitionTemplateService;
import avicit.bdp.dds.dao.entity.ProcessDefinitionTemplate;
import avicit.platform6.core.rest.msg.ResponseMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 流程定义模板控制器
 */
@RestController
@Api(tags = "流程定义模板REST接口")
@RequestMapping("/api/bdp/dds/processTemplate")
public class ProcessDefinitionTemplateRest {
    private static final Logger logger = LoggerFactory.getLogger(ProcessDefinitionTemplateRest.class);

    @Autowired
    private ProcessDefinitionTemplateService processDefinitionTemplateService;
    /**
     * 获取流程模型树
     *
     * @param projectType
     */
    @ApiOperation(value = "获取模板")
    @ApiImplicitParam(name = "projectType", value = "任务类型", type = "String")
    @GetMapping("/getProcessTemplateList")
    public ResponseMsg<List<ProcessDefinitionTemplate>> getProcessTemplateList(@RequestParam String projectType) {
        ResponseMsg<List<ProcessDefinitionTemplate>> responseMsg = new ResponseMsg<>();
        logger.info("projectType==============" + projectType);
        List<ProcessDefinitionTemplate> result = processDefinitionTemplateService.getProcessTemplateList(projectType);
        responseMsg.setResponseBody(result);
        return responseMsg;
    }
}
